home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 January / PCWorld_2007-01_cd.bin / v cisle / autoit / autoit-v3.2.0.1-setup.exe / Examples / Helpfile / _IEFormElementSetValue.au3 < prev    next >
Text File  |  2006-07-14  |  2KB  |  43 lines

  1. ; *******************************************************
  2. ; Example 1 - Open a browser with the form example, set the value of a text form element
  3. ; *******************************************************
  4. ;
  5. #include <IE.au3>
  6. $oIE = _IE_Example ("form")
  7. $oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
  8. $oText = _IEFormElementGetObjByName ($oForm, "textExample")
  9. _IEFormElementSetValue ($oText, "Hey! This works!")
  10.  
  11. ; *******************************************************
  12. ; Example 2 - Get a reference to a specific form element and set its value.
  13. ;                In this case, submit a query to the Google search engine
  14. ; *******************************************************
  15. ;
  16. #include <IE.au3>
  17. $oIE = _IECreate ("http://www.google.com")
  18. $oForm = _IEFormGetObjByName ($oIE, "f")
  19. $oQuery = _IEFormElementGetObjByName ($oForm, "q")
  20. _IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
  21. _IEFormSubmit ($oForm)
  22.  
  23. ; *******************************************************
  24. ; Example 3 - Login to Hotmail
  25. ; *******************************************************
  26. ;
  27. #include <IE.au3>
  28. ; Create a browser window and navigate to hotmail
  29. $oIE = _IECreate ("http://www.hotmail.com")
  30.  
  31. ; get pointers to the login form and username, password and signin fields
  32. $o_form = _IEFormGetObjByName ($oIE, "f1")
  33. $o_login = _IEFormElementGetObjByName ($o_form, "login")
  34. $o_password = _IEFormElementGetObjByName ($o_form, "passwd")
  35. $o_signin = _IEFormElementGetObjByName ($o_form, "SI")
  36.  
  37. $username = "your username here"
  38. $password = "your password here"
  39.  
  40. ; Set field values and submit the form
  41. _IEFormElementSetValue ($o_login, $username)
  42. _IEFormElementSetValue ($o_password, $password)
  43. _IEAction ($o_signin, "click")